This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
install.packages(“twitteR”)
consumer_key <- “dbWfi30JzOldr4AsLMPvcnDGY” consumer_secret <- “TFPD60ipk3WG3qE0oygJuCURMkpJyFH3YHg5QpJzQBDHxC720M” access_token <- “929140086951706624-zAPjLf53DTFe8ygdCSaYwLpL2TUcl1g” access_secret <- “7HmS3Ebql0xaEa2Urwj8OW64p1jCw0j13uplNTDzf87LJ”
twitteR::setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)
statuses = twitteR::searchTwitter(“terrorism”,n=100000000000,since=‘2010-01-01’,geocode=‘37.09024,-95.712891,1650mi’) #twitteR::getTrends(23424977)
You can also embed plots, for example:
data=read.csv(header=T,file = "Data.csv")
for (i in 1:ncol(data)) {
boxplot(data$Twitter ~ data[, i],xlab=names(data)[i])
}
chisq.test(data$Twitter,data$weaptype1_txt)
## Warning in chisq.test(data$Twitter, data$weaptype1_txt): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$weaptype1_txt
## X-squared = 20.33, df = 4, p-value = 0.0004298
par(mar=c(10,6,4,2)+0.1,mgp=c(5,1,0))
myData <- aggregate(data$Twitter,
by = list(weapon = data$weaptype1_txt),
FUN = function(x) c(mean = mean(x), sd = sd(x),
n = length(x)))
myData <- do.call(data.frame, myData)
myData$se <- myData$x.sd / sqrt(myData$x.n)
barCenters = barplot(height = myData$x.mean,
names.arg = myData$weapon,
beside = true, las = 2,
ylim = c(0, 1),
cex.names = 0.75,
main = "Weapon Type",
ylab = "Trending on Twitter",
#xlab = "Weapon Type",
border = "black", axes = TRUE,
las=2,axisnames = TRUE)
segments(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5)
arrows(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5, angle = 90,
code = 3, length = 0.05)
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
chisq.test(data$Twitter,data$targtype1_txt)
## Warning in chisq.test(data$Twitter, data$targtype1_txt): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$targtype1_txt
## X-squared = 22.474, df = 12, p-value = 0.03254
par(mar=c(8,6,4,2)+0.1,mgp=c(5,1,0))
myData <- aggregate(data$Twitter,
by = list(target = data$targtype1_txt),
FUN = function(x) c(mean = mean(x), sd = sd(x),
n = length(x)))
myData <- do.call(data.frame, myData)
myData$se <- myData$x.sd / sqrt(myData$x.n)
barCenters = barplot(height = myData$x.mean,
names.arg = myData$target,
beside = true, las = 2,
ylim = c(0, 1),
cex.names = 0.6,
main = "Target Type",
ylab = "Trending on Twitter",
border = "black")
segments(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5)
arrows(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5, angle = 90,
code = 3, length = 0.05)
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
chisq.test(data$Twitter,data$attacktype1_txt)
## Warning in chisq.test(data$Twitter, data$attacktype1_txt): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$attacktype1_txt
## X-squared = 28.003, df = 5, p-value = 3.635e-05
par(mar=c(10,6,4,2)+0.1,mgp=c(5,1,0))
myData <- aggregate(data$Twitter,
by = list(target = data$attacktype1_txt),
FUN = function(x) c(mean = mean(x), sd = sd(x),
n = length(x)))
myData <- do.call(data.frame, myData)
myData$se <- myData$x.sd / sqrt(myData$x.n)
barCenters = barplot(height = myData$x.mean,
names.arg = myData$target,
beside = true, las = 2,
ylim = c(0, 1),
cex.names = 0.6,
main = "Attack Type",
ylab = "Trending on Twitter",
border = "black")
segments(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5)
arrows(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5, angle = 90,
code = 3, length = 0.05)
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
chisq.test(data$Twitter,data$vicinity)
## Warning in chisq.test(data$Twitter, data$vicinity): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: data$Twitter and data$vicinity
## X-squared = 0.0002759, df = 1, p-value = 0.9867
chisq.test(data$Twitter,data$doubtterr)
## Warning in chisq.test(data$Twitter, data$doubtterr): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: data$Twitter and data$doubtterr
## X-squared = 0.10106, df = 1, p-value = 0.7506
chisq.test(data$Twitter,data$multiple)
## Warning in chisq.test(data$Twitter, data$multiple): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: data$Twitter and data$multiple
## X-squared = 0.033035, df = 1, p-value = 0.8558
chisq.test(data$Twitter,data$success)
## Warning in chisq.test(data$Twitter, data$success): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: data$Twitter and data$success
## X-squared = 2.5372e-29, df = 1, p-value = 1
chisq.test(data$Twitter,data$attacktype1_txt)
## Warning in chisq.test(data$Twitter, data$attacktype1_txt): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$attacktype1_txt
## X-squared = 28.003, df = 5, p-value = 3.635e-05
chisq.test(data$Twitter,data$targtype1_txt)
## Warning in chisq.test(data$Twitter, data$targtype1_txt): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$targtype1_txt
## X-squared = 22.474, df = 12, p-value = 0.03254
chisq.test(data$Twitter,data$gname)
## Warning in chisq.test(data$Twitter, data$gname): Chi-squared approximation
## may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$gname
## X-squared = 71.043, df = 16, p-value = 6.547e-09
chisq.test(data$Twitter,data$individual)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: data$Twitter and data$individual
## X-squared = 19.412, df = 1, p-value = 1.053e-05
chisq.test(data$Twitter,data$nperps)
## Warning in chisq.test(data$Twitter, data$nperps): Chi-squared approximation
## may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$nperps
## X-squared = 14.703, df = 5, p-value = 0.01171
chisq.test(data$Twitter,data$npercap)
## Warning in chisq.test(data$Twitter, data$npercap): Chi-squared
## approximation may be incorrect
##
## Chi-squared test for given probabilities
##
## data: data$Twitter
## X-squared = 78, df = 93, p-value = 0.8677
chisq.test(data$Twitter,data$claimed)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: data$Twitter and data$claimed
## X-squared = 18.949, df = 1, p-value = 1.343e-05
chisq.test(data$Twitter,data$weaptype1_txt)
## Warning in chisq.test(data$Twitter, data$weaptype1_txt): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$weaptype1_txt
## X-squared = 20.33, df = 4, p-value = 0.0004298
chisq.test(data$Twitter,data$nkill)
## Warning in chisq.test(data$Twitter, data$nkill): Chi-squared approximation
## may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$nkill
## X-squared = 47.11, df = 8, p-value = 1.461e-07
chisq.test(data$Twitter,data$nkillus)
## Warning in chisq.test(data$Twitter, data$nkillus): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$nkillus
## X-squared = 47.073, df = 8, p-value = 1.485e-07
chisq.test(data$Twitter,data$nkillter)
## Warning in chisq.test(data$Twitter, data$nkillter): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$nkillter
## X-squared = 35.825, df = 2, p-value = 1.662e-08
chisq.test(data$Twitter,data$nwound)
## Warning in chisq.test(data$Twitter, data$nwound): Chi-squared approximation
## may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$nwound
## X-squared = 48.465, df = 11, p-value = 1.179e-06
chisq.test(data$Twitter,data$nwoundus)
## Warning in chisq.test(data$Twitter, data$nwoundus): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$nwoundus
## X-squared = 49.581, df = 11, p-value = 7.444e-07
chisq.test(data$Twitter,data$nwoundte)
## Warning in chisq.test(data$Twitter, data$nwoundte): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: data$Twitter and data$nwoundte
## X-squared = 8.4706e-29, df = 1, p-value = 1
chisq.test(data$Twitter,data$property)
## Warning in chisq.test(data$Twitter, data$property): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$property
## X-squared = 9.8795, df = 2, p-value = 0.007156
chisq.test(data$Twitter,data$propextent_txt)
## Warning in chisq.test(data$Twitter, data$propextent_txt): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$propextent_txt
## X-squared = 10.183, df = 3, p-value = 0.01708
chisq.test(data$Twitter,data$ishostkid)
## Warning in chisq.test(data$Twitter, data$ishostkid): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: data$Twitter and data$ishostkid
## X-squared = 4.8635, df = 1, p-value = 0.02743
chisq.test(data$Twitter,data$INT_ANY)
## Warning in chisq.test(data$Twitter, data$INT_ANY): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: data$Twitter and data$INT_ANY
## X-squared = 0.38718, df = 2, p-value = 0.824
dataInd=read.csv(header=T,file = "Data_controlled_individual.csv")
dataGr=read.csv(header=T,file = "Data_controlled_group.csv")
dataSmall=read.csv(header=T,file = "Data_controlled_0kill<10wound.csv")
dataLarge=read.csv(header=T,file = "Data_controlled_>0kill>10wound.csv")
dataCont=read.csv(header=T,file = "Data_controlled.csv")
dataCivil=read.csv(header=T,file = "Data_controlled_citizens.csv")
chisq.test(dataCont$Twitter,dataCont$vicinity)
## Warning in chisq.test(dataCont$Twitter, dataCont$vicinity): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCont$Twitter and dataCont$vicinity
## X-squared = 0.0082333, df = 1, p-value = 0.9277
chisq.test(dataCont$Twitter,dataCont$doubtterr)
## Warning in chisq.test(dataCont$Twitter, dataCont$doubtterr): Chi-squared
## approximation may be incorrect
##
## Chi-squared test for given probabilities
##
## data: dataCont$Twitter
## X-squared = 61, df = 74, p-value = 0.8606
chisq.test(dataCont$Twitter,dataCont$multiple)
## Warning in chisq.test(dataCont$Twitter, dataCont$multiple): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCont$Twitter and dataCont$multiple
## X-squared = 1.079e-30, df = 1, p-value = 1
chisq.test(dataCont$Twitter,dataCont$success)
## Warning in chisq.test(dataCont$Twitter, dataCont$success): Chi-squared
## approximation may be incorrect
##
## Chi-squared test for given probabilities
##
## data: dataCont$Twitter
## X-squared = 61, df = 74, p-value = 0.8606
chisq.test(dataCont$Twitter,dataCont$attacktype1_txt)
## Warning in chisq.test(dataCont$Twitter, dataCont$attacktype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$attacktype1_txt
## X-squared = 25.82, df = 4, p-value = 3.441e-05
chisq.test(dataCont$Twitter,dataCont$targtype1_txt)
## Warning in chisq.test(dataCont$Twitter, dataCont$targtype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$targtype1_txt
## X-squared = 19.923, df = 11, p-value = 0.04641
chisq.test(dataCont$Twitter,dataCont$gname)
## Warning in chisq.test(dataCont$Twitter, dataCont$gname): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$gname
## X-squared = 56.996, df = 14, p-value = 3.917e-07
chisq.test(dataCont$Twitter,dataCont$individual)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCont$Twitter and dataCont$individual
## X-squared = 19.202, df = 1, p-value = 1.176e-05
chisq.test(dataCont$Twitter,dataCont$nperps)
## Warning in chisq.test(dataCont$Twitter, dataCont$nperps): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$nperps
## X-squared = 13.691, df = 5, p-value = 0.0177
chisq.test(dataCont$Twitter,dataCont$npercap)
## Warning in chisq.test(dataCont$Twitter, dataCont$npercap): Chi-squared
## approximation may be incorrect
##
## Chi-squared test for given probabilities
##
## data: dataCont$Twitter
## X-squared = 61, df = 74, p-value = 0.8606
chisq.test(dataCont$Twitter,dataCont$claimed)
## Warning in chisq.test(dataCont$Twitter, dataCont$claimed): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCont$Twitter and dataCont$claimed
## X-squared = 14.626, df = 1, p-value = 0.0001311
chisq.test(dataCont$Twitter,dataCont$weaptype1_txt)
## Warning in chisq.test(dataCont$Twitter, dataCont$weaptype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$weaptype1_txt
## X-squared = 19.151, df = 3, p-value = 0.0002545
chisq.test(dataCont$Twitter,dataCont$nkill)
## Warning in chisq.test(dataCont$Twitter, dataCont$nkill): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$nkill
## X-squared = 43.933, df = 8, p-value = 5.858e-07
chisq.test(dataCont$Twitter,dataCont$nkillus)
## Warning in chisq.test(dataCont$Twitter, dataCont$nkillus): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$nkillus
## X-squared = 39.403, df = 8, p-value = 4.137e-06
chisq.test(dataCont$Twitter,dataCont$nkillter)
## Warning in chisq.test(dataCont$Twitter, dataCont$nkillter): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$nkillter
## X-squared = 30.849, df = 2, p-value = 2.001e-07
chisq.test(dataCont$Twitter,dataCont$nwound)
## Warning in chisq.test(dataCont$Twitter, dataCont$nwound): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$nwound
## X-squared = 43.713, df = 11, p-value = 8.156e-06
chisq.test(dataCont$Twitter,dataCont$nwoundus)
## Warning in chisq.test(dataCont$Twitter, dataCont$nwoundus): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$nwoundus
## X-squared = 43.578, df = 11, p-value = 8.613e-06
chisq.test(dataCont$Twitter,dataCont$nwoundte)
## Warning in chisq.test(dataCont$Twitter, dataCont$nwoundte): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCont$Twitter and dataCont$nwoundte
## X-squared = 5.7886e-32, df = 1, p-value = 1
chisq.test(dataCont$Twitter,dataCont$property)
## Warning in chisq.test(dataCont$Twitter, dataCont$property): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$property
## X-squared = 15.974, df = 2, p-value = 0.0003398
chisq.test(dataCont$Twitter,dataCont$propextent_txt)
## Warning in chisq.test(dataCont$Twitter, dataCont$propextent_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$propextent_txt
## X-squared = 15.593, df = 3, p-value = 0.001374
chisq.test(dataCont$Twitter,dataCont$ishostkid)
## Warning in chisq.test(dataCont$Twitter, dataCont$ishostkid): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCont$Twitter and dataCont$ishostkid
## X-squared = 4.295, df = 1, p-value = 0.03822
chisq.test(dataCont$Twitter,dataCont$INT_ANY)
## Warning in chisq.test(dataCont$Twitter, dataCont$INT_ANY): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCont$Twitter and dataCont$INT_ANY
## X-squared = 0.66052, df = 2, p-value = 0.7187
chisq.test(dataInd$Twitter,dataInd$multiple)
## Warning in chisq.test(dataInd$Twitter, dataInd$multiple): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataInd$Twitter and dataInd$multiple
## X-squared = 0.13846, df = 1, p-value = 0.7098
chisq.test(dataInd$Twitter,dataInd$attacktype1_txt)
## Warning in chisq.test(dataInd$Twitter, dataInd$attacktype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$attacktype1_txt
## X-squared = 9.6058, df = 4, p-value = 0.04762
chisq.test(dataInd$Twitter,dataInd$targtype1_txt)
## Warning in chisq.test(dataInd$Twitter, dataInd$targtype1_txt): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$targtype1_txt
## X-squared = 8.8455, df = 9, p-value = 0.4517
chisq.test(dataInd$Twitter,dataInd$gname)
## Warning in chisq.test(dataInd$Twitter, dataInd$gname): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$gname
## X-squared = 23.174, df = 11, p-value = 0.0167
chisq.test(dataInd$Twitter,dataInd$nperps)
## Warning in chisq.test(dataInd$Twitter, dataInd$nperps): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$nperps
## X-squared = 0.79398, df = 2, p-value = 0.6723
chisq.test(dataInd$Twitter,dataInd$npercap)
## Warning in chisq.test(dataInd$Twitter, dataInd$npercap): Chi-squared
## approximation may be incorrect
##
## Chi-squared test for given probabilities
##
## data: dataInd$Twitter
## X-squared = 19, df = 32, p-value = 0.9665
chisq.test(dataInd$Twitter,dataInd$claimed)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataInd$Twitter and dataInd$claimed
## X-squared = 1.3569, df = 1, p-value = 0.2441
chisq.test(dataInd$Twitter,dataInd$weaptype1_txt)
## Warning in chisq.test(dataInd$Twitter, dataInd$weaptype1_txt): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$weaptype1_txt
## X-squared = 5.0788, df = 3, p-value = 0.1661
chisq.test(dataInd$Twitter,dataInd$nkill)
## Warning in chisq.test(dataInd$Twitter, dataInd$nkill): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$nkill
## X-squared = 15.123, df = 8, p-value = 0.0568
chisq.test(dataInd$Twitter,dataInd$nkillus)
## Warning in chisq.test(dataInd$Twitter, dataInd$nkillus): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$nkillus
## X-squared = 13.248, df = 8, p-value = 0.1036
chisq.test(dataInd$Twitter,dataInd$nkillter)
## Warning in chisq.test(dataInd$Twitter, dataInd$nkillter): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$nkillter
## X-squared = 8.8065, df = 2, p-value = 0.01224
chisq.test(dataInd$Twitter,dataInd$nwound)
## Warning in chisq.test(dataInd$Twitter, dataInd$nwound): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$nwound
## X-squared = 15.706, df = 10, p-value = 0.1084
chisq.test(dataInd$Twitter,dataInd$nwoundus)
## Warning in chisq.test(dataInd$Twitter, dataInd$nwoundus): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$nwoundus
## X-squared = 15.173, df = 10, p-value = 0.1259
chisq.test(dataInd$Twitter,dataInd$nwoundte)
## Warning in chisq.test(dataInd$Twitter, dataInd$nwoundte): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataInd$Twitter and dataInd$nwoundte
## X-squared = 7.1985e-31, df = 1, p-value = 1
chisq.test(dataInd$Twitter,dataInd$property)
## Warning in chisq.test(dataInd$Twitter, dataInd$property): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$property
## X-squared = 2.4671, df = 2, p-value = 0.2913
chisq.test(dataInd$Twitter,dataInd$propextent_txt)
## Warning in chisq.test(dataInd$Twitter, dataInd$propextent_txt): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataInd$Twitter and dataInd$propextent_txt
## X-squared = 2.8069, df = 2, p-value = 0.2458
chisq.test(dataInd$Twitter,dataInd$ishostkid)
## Warning in chisq.test(dataInd$Twitter, dataInd$ishostkid): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataInd$Twitter and dataInd$ishostkid
## X-squared = 0.92495, df = 1, p-value = 0.3362
chisq.test(dataInd$Twitter,dataInd$INT_ANY)
## Warning in chisq.test(dataInd$Twitter, dataInd$INT_ANY): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataInd$Twitter and dataInd$INT_ANY
## X-squared = 9.0467e-32, df = 1, p-value = 1
chisq.test(dataLarge$Twitter,dataLarge$multiple)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$multiple): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataLarge$Twitter and dataLarge$multiple
## X-squared = 1.2308, df = 1, p-value = 0.2673
chisq.test(dataLarge$Twitter,dataLarge$attacktype1_txt)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$attacktype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataLarge$Twitter and dataLarge$attacktype1_txt
## X-squared = 1.7778, df = 2, p-value = 0.4111
chisq.test(dataLarge$Twitter,dataLarge$targtype1_txt)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$targtype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataLarge$Twitter and dataLarge$targtype1_txt
## X-squared = 8.4444, df = 7, p-value = 0.295
chisq.test(dataLarge$Twitter,dataLarge$gname)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$gname): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataLarge$Twitter and dataLarge$gname
## X-squared = 13.333, df = 6, p-value = 0.03804
chisq.test(dataLarge$Twitter,dataLarge$nperps)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$nperps): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataLarge$Twitter and dataLarge$nperps
## X-squared = 0, df = 1, p-value = 1
chisq.test(dataLarge$Twitter,dataLarge$npercap)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$npercap): Chi-squared
## approximation may be incorrect
##
## Chi-squared test for given probabilities
##
## data: dataLarge$Twitter
## X-squared = 4, df = 15, p-value = 0.9977
chisq.test(dataLarge$Twitter,dataLarge$claimed)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$claimed): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataLarge$Twitter and dataLarge$claimed
## X-squared = 1.4222, df = 1, p-value = 0.233
chisq.test(dataLarge$Twitter,dataLarge$weaptype1_txt)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$weaptype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataLarge$Twitter and dataLarge$weaptype1_txt
## X-squared = 0.8, df = 2, p-value = 0.6703
chisq.test(dataLarge$Twitter,dataLarge$nkill)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$nkill): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataLarge$Twitter and dataLarge$nkill
## X-squared = 6.0444, df = 8, p-value = 0.6423
chisq.test(dataLarge$Twitter,dataLarge$nkillus)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$nkillus): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataLarge$Twitter and dataLarge$nkillus
## X-squared = 7.1111, df = 8, p-value = 0.5247
chisq.test(dataLarge$Twitter,dataLarge$nkillter)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$nkillter): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataLarge$Twitter and dataLarge$nkillter
## X-squared = 0.8, df = 2, p-value = 0.6703
chisq.test(dataLarge$Twitter,dataLarge$nwound)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$nwound): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataLarge$Twitter and dataLarge$nwound
## X-squared = 12.444, df = 10, p-value = 0.2564
chisq.test(dataLarge$Twitter,dataLarge$nwoundus)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$nwoundus): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataLarge$Twitter and dataLarge$nwoundus
## X-squared = 12.444, df = 10, p-value = 0.2564
chisq.test(dataLarge$Twitter,dataLarge$nwoundte)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$nwoundte): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataLarge$Twitter and dataLarge$nwoundte
## X-squared = 0.35556, df = 1, p-value = 0.551
chisq.test(dataLarge$Twitter,dataLarge$property)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$property): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataLarge$Twitter and dataLarge$property
## X-squared = 1.0667, df = 2, p-value = 0.5866
chisq.test(dataLarge$Twitter,dataLarge$propextent_txt)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$propextent_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataLarge$Twitter and dataLarge$propextent_txt
## X-squared = 0.09697, df = 1, p-value = 0.7555
chisq.test(dataLarge$Twitter,dataLarge$ishostkid)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$ishostkid): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataLarge$Twitter and dataLarge$ishostkid
## X-squared = 0, df = 1, p-value = 1
chisq.test(dataLarge$Twitter,dataLarge$INT_ANY)
## Warning in chisq.test(dataLarge$Twitter, dataLarge$INT_ANY): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataLarge$Twitter and dataLarge$INT_ANY
## X-squared = 0, df = 1, p-value = 1
chisq.test(dataSmall$Twitter,dataSmall$vicinity)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$vicinity): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataSmall$Twitter and dataSmall$vicinity
## X-squared = 4.5287e-29, df = 1, p-value = 1
chisq.test(dataSmall$Twitter,dataSmall$multiple)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$multiple): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataSmall$Twitter and dataSmall$multiple
## X-squared = 3.0069, df = 1, p-value = 0.08291
chisq.test(dataSmall$Twitter,dataSmall$attacktype1_txt)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$attacktype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataSmall$Twitter and dataSmall$attacktype1_txt
## X-squared = 10.144, df = 3, p-value = 0.01738
chisq.test(dataSmall$Twitter,dataSmall$targtype1_txt)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$targtype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataSmall$Twitter and dataSmall$targtype1_txt
## X-squared = 31.858, df = 9, p-value = 0.0002107
chisq.test(dataSmall$Twitter,dataSmall$gname)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$gname): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataSmall$Twitter and dataSmall$gname
## X-squared = 38.643, df = 11, p-value = 6.09e-05
chisq.test(dataSmall$Twitter,dataSmall$individual)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$individual): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataSmall$Twitter and dataSmall$individual
## X-squared = 2.153, df = 1, p-value = 0.1423
chisq.test(dataSmall$Twitter,dataSmall$nperps)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$nperps): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataSmall$Twitter and dataSmall$nperps
## X-squared = 3.2403, df = 5, p-value = 0.663
chisq.test(dataSmall$Twitter,dataSmall$npercap)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$npercap): Chi-squared
## approximation may be incorrect
##
## Chi-squared test for given probabilities
##
## data: dataSmall$Twitter
## X-squared = 57, df = 58, p-value = 0.5125
chisq.test(dataSmall$Twitter,dataSmall$claimed)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$claimed): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataSmall$Twitter and dataSmall$claimed
## X-squared = 3.0069, df = 1, p-value = 0.08291
chisq.test(dataSmall$Twitter,dataSmall$weaptype1_txt)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$weaptype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataSmall$Twitter and dataSmall$weaptype1_txt
## X-squared = 10.144, df = 3, p-value = 0.01738
chisq.test(dataSmall$Twitter,dataSmall$nwound)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$nwound): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataSmall$Twitter and dataSmall$nwound
## X-squared = 0.23436, df = 4, p-value = 0.9936
chisq.test(dataSmall$Twitter,dataSmall$nwoundus)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$nwoundus): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataSmall$Twitter and dataSmall$nwoundus
## X-squared = 0.19542, df = 4, p-value = 0.9955
chisq.test(dataSmall$Twitter,dataSmall$property)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$property): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataSmall$Twitter and dataSmall$property
## X-squared = 0.27868, df = 2, p-value = 0.8699
chisq.test(dataSmall$Twitter,dataSmall$propextent_txt)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$propextent_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataSmall$Twitter and dataSmall$propextent_txt
## X-squared = 0.52856, df = 3, p-value = 0.9126
chisq.test(dataSmall$Twitter,dataSmall$INT_ANY)
## Warning in chisq.test(dataSmall$Twitter, dataSmall$INT_ANY): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataSmall$Twitter and dataSmall$INT_ANY
## X-squared = 0.1109, df = 2, p-value = 0.9461
chisq.test(dataCivil$Twitter,dataCivil$multiple)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$multiple): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCivil$Twitter and dataCivil$multiple
## X-squared = 1.875, df = 1, p-value = 0.1709
chisq.test(dataCivil$Twitter,dataCivil$attacktype1_txt)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$attacktype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCivil$Twitter and dataCivil$attacktype1_txt
## X-squared = 3, df = 3, p-value = 0.3916
chisq.test(dataCivil$Twitter,dataCivil$gname)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$gname): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCivil$Twitter and dataCivil$gname
## X-squared = 12, df = 5, p-value = 0.03479
chisq.test(dataCivil$Twitter,dataCivil$individual)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$individual): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCivil$Twitter and dataCivil$individual
## X-squared = 0.075, df = 1, p-value = 0.7842
chisq.test(dataCivil$Twitter,dataCivil$nperps)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$nperps): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCivil$Twitter and dataCivil$nperps
## X-squared = 3.225, df = 4, p-value = 0.5209
chisq.test(dataCivil$Twitter,dataCivil$npercap)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$npercap): Chi-squared
## approximation may be incorrect
##
## Chi-squared test for given probabilities
##
## data: dataCivil$Twitter
## X-squared = 8, df = 11, p-value = 0.7133
chisq.test(dataCivil$Twitter,dataCivil$claimed)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$claimed): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCivil$Twitter and dataCivil$claimed
## X-squared = 2.1, df = 1, p-value = 0.1473
chisq.test(dataCivil$Twitter,dataCivil$weaptype1_txt)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$weaptype1_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCivil$Twitter and dataCivil$weaptype1_txt
## X-squared = 1.65, df = 3, p-value = 0.6481
chisq.test(dataCivil$Twitter,dataCivil$nkill)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$nkill): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCivil$Twitter and dataCivil$nkill
## X-squared = 4.8, df = 2, p-value = 0.09072
chisq.test(dataCivil$Twitter,dataCivil$nkillus)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$nkillus): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCivil$Twitter and dataCivil$nkillus
## X-squared = 0.13636, df = 1, p-value = 0.7119
chisq.test(dataCivil$Twitter,dataCivil$nkillter)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$nkillter): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCivil$Twitter and dataCivil$nkillter
## X-squared = 4.8, df = 2, p-value = 0.09072
chisq.test(dataCivil$Twitter,dataCivil$nwound)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$nwound): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCivil$Twitter and dataCivil$nwound
## X-squared = 5.25, df = 5, p-value = 0.3861
chisq.test(dataCivil$Twitter,dataCivil$nwoundus)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$nwoundus): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCivil$Twitter and dataCivil$nwoundus
## X-squared = 4.878, df = 5, p-value = 0.431
chisq.test(dataCivil$Twitter,dataCivil$property)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$property): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCivil$Twitter and dataCivil$property
## X-squared = 1.7327e-31, df = 1, p-value = 1
chisq.test(dataCivil$Twitter,dataCivil$propextent_txt)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$propextent_txt): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: dataCivil$Twitter and dataCivil$propextent_txt
## X-squared = 1.7327e-31, df = 1, p-value = 1
chisq.test(dataCivil$Twitter,dataCivil$INT_ANY)
## Warning in chisq.test(dataCivil$Twitter, dataCivil$INT_ANY): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: dataCivil$Twitter and dataCivil$INT_ANY
## X-squared = 1.2, df = 2, p-value = 0.5488
data=dataCont
par(mar=c(10,6,4,2)+0.1,mgp=c(5,1,0))
myData <- aggregate(data$Twitter,
by = list(target = data$attacktype1_txt),
FUN = function(x) c(mean = mean(x), sd = sd(x),
n = length(x)))
myData <- do.call(data.frame, myData)
myData$se <- myData$x.sd / sqrt(myData$x.n)
barCenters = barplot(height = myData$x.mean,
names.arg = myData$target,
beside = true, las = 2,
ylim = c(0, 1),
cex.names = 0.6,
main = "Attack Type",
ylab = "Trending on Twitter",
border = "black")
segments(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5)
arrows(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5, angle = 90,
code = 3, length = 0.05)
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
data=dataCont
par(mar=c(10,6,4,2)+0.1,mgp=c(5,1,0))
myData <- aggregate(data$Twitter,
by = list(weapon = data$weaptype1_txt),
FUN = function(x) c(mean = mean(x), sd = sd(x),
n = length(x)))
myData <- do.call(data.frame, myData)
myData$se <- myData$x.sd / sqrt(myData$x.n)
barCenters = barplot(height = myData$x.mean,
names.arg = myData$weapon,
beside = true, las = 2,
ylim = c(0, 1),
cex.names = 0.75,
main = "Weapon Type",
ylab = "Trending on Twitter",
#xlab = "Weapon Type",
border = "black", axes = TRUE,
las=2,axisnames = TRUE)
segments(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5)
arrows(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5, angle = 90,
code = 3, length = 0.05)
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
data=dataCont
par(mar=c(8,6,4,2)+0.1,mgp=c(5,1,0))
myData <- aggregate(data$Twitter,
by = list(target = data$targtype1_txt),
FUN = function(x) c(mean = mean(x), sd = sd(x),
n = length(x)))
myData <- do.call(data.frame, myData)
myData$se <- myData$x.sd / sqrt(myData$x.n)
barCenters = barplot(height = myData$x.mean,
names.arg = myData$target,
beside = true, las = 2,
ylim = c(0, 1),
cex.names = 0.6,
main = "Target Type",
ylab = "Trending on Twitter",
border = "black")
segments(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5)
arrows(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5, angle = 90,
code = 3, length = 0.05)
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
data=dataSmall
par(mar=c(10,6,4,2)+0.1,mgp=c(5,1,0))
myData <- aggregate(data$Twitter,
by = list(target = data$attacktype1_txt),
FUN = function(x) c(mean = mean(x), sd = sd(x),
n = length(x)))
myData <- do.call(data.frame, myData)
myData$se <- myData$x.sd / sqrt(myData$x.n)
barCenters = barplot(height = myData$x.mean,
names.arg = myData$target,
beside = true, las = 2,
ylim = c(0, 1),
cex.names = 0.6,
main = "Attack Type (Small Attacks)",
ylab = "Trending on Twitter",
border = "black")
segments(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5)
arrows(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5, angle = 90,
code = 3, length = 0.05)
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
data=dataSmall
par(mar=c(10,6,4,2)+0.1,mgp=c(5,1,0))
myData <- aggregate(data$Twitter,
by = list(weapon = data$weaptype1_txt),
FUN = function(x) c(mean = mean(x), sd = sd(x),
n = length(x)))
myData <- do.call(data.frame, myData)
myData$se <- myData$x.sd / sqrt(myData$x.n)
barCenters = barplot(height = myData$x.mean,
names.arg = myData$weapon,
beside = true, las = 2,
ylim = c(0, 1),
cex.names = 0.75,
main = "Weapon Type (Small Attacks)",
ylab = "Trending on Twitter",
#xlab = "Weapon Type",
border = "black", axes = TRUE,
las=2,axisnames = TRUE)
segments(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5)
arrows(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5, angle = 90,
code = 3, length = 0.05)
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
data=dataSmall
par(mar=c(8,6,4,2)+0.1,mgp=c(5,1,0))
myData <- aggregate(data$Twitter,
by = list(target = data$targtype1_txt),
FUN = function(x) c(mean = mean(x), sd = sd(x),
n = length(x)))
myData <- do.call(data.frame, myData)
myData$se <- myData$x.sd / sqrt(myData$x.n)
barCenters = barplot(height = myData$x.mean,
names.arg = myData$target,
beside = true, las = 2,
ylim = c(0, 1),
cex.names = 0.6,
main = "Target Type (Small Attacks)",
ylab = "Trending on Twitter",
border = "black")
segments(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5)
arrows(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5, angle = 90,
code = 3, length = 0.05)
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
data=dataCont
par(mar=c(10,6,4,2)+0.1,mgp=c(5,1,0))
myData <- aggregate(data$Twitter,
by = list(weapon = data$gname),
FUN = function(x) c(mean = mean(x), sd = sd(x),
n = length(x)))
myData <- do.call(data.frame, myData)
myData$se <- myData$x.sd / sqrt(myData$x.n)
barCenters = barplot(height = myData$x.mean,
names.arg = myData$weapon,
beside = true, las = 2,
ylim = c(0, 1),
cex.names = 0.75,
main = "Group or Identity",
ylab = "Trending on Twitter",
border = "black", axes = TRUE)
segments(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5)
arrows(barCenters, myData$x.mean - myData$se * 2, barCenters,
myData$x.mean + myData$se * 2, lwd = 1.5, angle = 90,
code = 3, length = 0.05)
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(barCenters, myData$x.mean - myData$se * 2, barCenters, :
## zero-length arrow is of indeterminate angle and so skipped